package my.li.zhcsrenthousefront.controller;


import Vo.House;
import Vo.Store;
import land.RentHouseInterface;
import land.StoreFeiginInterface;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import page.PageBean;
import util.JsonResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/house")
public class RentHouseController {
    private RentHouseInterface feiginInterface;


    @RequestMapping("/")
    public String frist(HttpSession session){
        session.setAttribute("houses",new ArrayList<House>());
        session.setAttribute("pagebean",new PageBean());
        return "house_manager";
    }

    @RequestMapping("/getAll")
    public String getAllMes(PageBean pageBean, HttpServletRequest request){
        System.out.println("======================= 进行分页查询");
        HttpSession session = request.getSession();
        session.setAttribute("pagebean",pageBean);

        List<House> houses = new ArrayList<>();
        session.setAttribute("houses",houses);
        return "house_manager";
    }

    @RequestMapping("/getById")
    @ResponseBody
    public JsonResult queryById(House house){
        System.out.println("queryByIdHouse :  "+house);
        return JsonResult.successWithoutData();
    }


    @RequestMapping("/add")
    @ResponseBody
    public JsonResult addLand(House house){

        System.out.println("addHouse : "+house);
        return JsonResult.successWithoutData();
    }

    @RequestMapping("house_add")
    public String getAdd(House house){
        //查询
        return "house_add";
    }

    @RequestMapping("deleteById")
    @ResponseBody
    public JsonResult deleteByLandId(House house){
        System.out.println("deleteHouse:" + house);
        return JsonResult.successWithoutData();
    }


}
